<template>
	<div class="toref">
	<h3>5 ToRef函数</h3>
	<p>msg的值是 {{msg}}</p>
	<p>obj.message is {{obj.message}}</p>
	<button v-on:click="changeMsg()">chaneg message</button>
	</div>
</template>


<script setup>
	import { reactive,toRef } from 'vue'
	let obj = reactive({
		message:'黑发不知勤学早白首方悔读书迟'
	})
	let msg = toRef(obj,'message')
	const changeMsg = () => {
		msg.value = '少壮不努力老大徒伤悲'
	}

</script>



<style scoped>
.toref{
 	font-size: 16px;
 	font-weight: bold;
 	width: 200px;
 	height: 200px;
 	border: 1px solid royalblue;
 }
</style>
